package br.edu.utfpr.backuptools.BackupTools.view.action.backup;

import br.edu.utfpr.backuptools.BackupTools.controller.ControladorBackupImpl;
import br.edu.utfpr.backuptools.BackupTools.controller.interfaces.ControladorBackup;
import br.edu.utfpr.backuptools.BackupTools.controller.validator.BackupValidator;
import br.edu.utfpr.backuptools.BackupTools.controller.validator.RetornoValidacao;
import br.edu.utfpr.backuptools.BackupTools.model.dao.DaoBackupImpl;
import br.edu.utfpr.backuptools.BackupTools.model.dao.interfaces.DaoBackup;
import br.edu.utfpr.backuptools.BackupTools.model.pojo.Backup;
import br.edu.utfpr.backuptools.BackupTools.view.action.AbstractAction;

public class GerarBackupIndividual extends AbstractAction<Backup>{
	DaoBackup dao = new DaoBackupImpl();
	ControladorBackup controlador = new ControladorBackupImpl(dao, new BackupValidator());
	
	@Override
	public RetornoValidacao execute(Backup bean) {
		try {
			controlador.gerarBackup(bean);
			return new RetornoValidacao();
		} catch (Exception e) {
			return new RetornoValidacao("Ocorreu um erro ao executar o backup");
		}
		
	}
}
